Skip to content

WP-11508: Publish from a job that builds nothing, with npm trusted publishing - #900

Merged
Patrick Lafrance (patricklafrance) merged 2 commits into
mainfrom
feature/WP-11508_split-publish-job
Nov 26, 2026
Merged

Patrick Lafrance (patricklafrance) merged 2 commits into
mainfrom
feature/WP-11508_split-publish-job

Conversation

@patricklafrance

@patricklafrance Patrick Lafrance (patricklafrance) commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

General infos:

  • Associated Feature Switch? No
  • How was the change tested? Locally, on a script-free install (pnpm install --ignore-scripts): the 47 packages build, changeset publish-plan and changeset pack select and pack the four versions that are not on npm yet, and changeset version works with the updated config. The workflow itself only runs on main, so its four jobs are first exercised by the push that merges this PR.
  • Out of scope for this PR: The npm-publish environment, the npm trusted publishers and the retirement of WORKLEAP_NPM_TOKEN are settings, not code (see Before merging).

WP-11508

Why?

The publish job ran the dependency install, changeset version, the whole package build and lerna publish in the one job that held the npm publishing token and a write-scoped GITHUB_TOKEN. Every build-time dependency could read both. The token was long-lived, readable from a workflow run on any branch, and the published packages carried no provenance.

What changed?

  • publish.yml: split into four jobs with the changesets/action v2 sub-actions, the layout wl-squide already uses.

    Job Runs when Permissions Purpose
    select-mode Always contents: read Decides between version, publish and none
    version Changesets are pending contents: write, pull-requests: write Creates or updates the "Changeset: New Version" PR
    pack A package version is not on npm yet contents: read Builds the packages and packs them into tarballs, uploaded as an artifact
    publish After pack id-token: write, contents: read Publishes the tarballs to npm
  • No static npm token: WORKLEAP_NPM_TOKEN, NPM_TOKEN and NODE_AUTH_TOKEN are gone from the workflow. The publish job uses npm trusted publishing, in the npm-publish environment, so published versions carry provenance.

  • Installs and checkouts: every install runs with --ignore-scripts, and every checkout sets persist-credentials: false.

  • @changesets/cli 2.25.0 → 3.0.3: the v2 sub-actions require Changesets 3. The lockfile change is limited to the Changesets dependency tree.

  • .changeset/config.json: privatePackages: { version: true, tag: false }. Changesets 3 no longer versions private packages by default, and website and @shared/components have changelogs.

  • package.json: removed prepublish-ci and publish-ci. The build they ran now runs in the pack job, and lerna publish is no longer used.

Before merging

The publish job fails until both settings exist:

  1. The npm-publish environment in the repository settings, with main as its only deployment branch. GitHub creates a missing environment without any protection.
  2. On npm, a trusted publisher on each of the 47 @igloo-ui/* packages: repository workleap/ov-igloo-ui, workflow publish.yml, environment npm-publish.

After the first green publish, revoke WORKLEAP_NPM_TOKEN or remove this repository's access to it.

Other Notes

  • Publishing is already failing on main: two runs of this workflow ended with lerna ERR! E404 at the publish step. Since chore(deps): update github pipeline dependencies (major) #899 moved changesets/action to v2.1.2, it fails earlier: v2 requires Changesets CLI 3 and renamed the inputs the old workflow passes. This PR brings both. @igloo-ui/metric@1.0.1, @igloo-ui/stepper@0.7.1, @igloo-ui/tag-picker@0.17.1 and @igloo-ui/text-editor@1.0.1 are versioned on main but not on npm. The first green run of this workflow publishes them.
  • No git tags or GitHub releases: the repository has never had any, so both are turned off in the publish job, which keeps it at contents: read.
  • Never rename publish.yml or the npm-publish environment: the npm trusted publisher of every package is bound to both names.
  • Nothing checks the split automatically: review any later change to this workflow against the table above. A step added to the publish job can request the npm publishing token.
  • Changesets 3 behaviour changes that apply here: changeset version exits with code 1 when no changeset is pending, and a peer dependency bump now bumps dependents by patch instead of major.

🤖 Generated with Claude Code

@changeset-bot

changeset-bot Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3d3ec7a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@patricklafrance
Patrick Lafrance (patricklafrance) marked this pull request as ready for review November 26, 2026 19:11
Copilot AI balanced review requested due to automatic review settings November 26, 2026 19:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human verification is needed for the external main-only environment protection and all 47 npm trusted-publisher bindings, followed by validation of the first end-to-end OIDC publish and provenance on main.

No open issues 🎉

1 file not reviewed
  • pnpm-lock.yaml: Generated file
What changed in this PR

This PR separates package builds from npm publishing, limiting publishing permissions to a dedicated job that publishes prebuilt tarballs using npm trusted publishing.

Changes:

  • Splits the release workflow into mode selection, versioning, packing, and publishing jobs with job-specific permissions.
  • Removes static npm tokens, disables install scripts, and prevents checkouts from persisting credentials.
  • Upgrades Changesets to 3.0.3, preserves private-package versioning, and removes obsolete publishing scripts.
File Description
pnpm-lock.yaml Updates the Changesets dependency tree for version 3.0.3.
package.json Upgrades Changesets and removes the former build-and-publish scripts.
.github/​workflows/​publish.yml Separates release stages and enables trusted publishing of packed artifacts.
.changeset/​config.json Keeps private packages versioned without creating tags for them.

Review effort: Balanced

…t-publish-job

# Conflicts:
#	.github/workflows/publish.yml
@patricklafrance
Patrick Lafrance (patricklafrance) merged commit 96f4f85 into main Nov 26, 2026
9 of 10 checks passed
@patricklafrance
Patrick Lafrance (patricklafrance) deleted the feature/WP-11508_split-publish-job branch November 26, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants